Skip to content

chore(agents): generate Copilot agent pointers from shared definitions - #18093

Open
kdinev wants to merge 1 commit into
chore/agents-remove-acsfrom
chore/agents-sync-generator
Open

kdinev wants to merge 1 commit into
chore/agents-remove-acsfrom
chore/agents-sync-generator

Conversation

@kdinev

@kdinev kdinev commented Dec 4, 2026

Copy link
Copy Markdown
Member

Stack 2/3. Based on #18092. Review that one first; this PR's diff only shows its own changes.

Description

Generates the Copilot pointer files in .github/agents/ from the shared agent definitions with a new script, scripts/sync-agents.mjs, and fails CI when they drift.

  • Shared definitions: .agents/agents/*.md keeps tool-neutral fields (name, description) at the top level, and the Copilot tools, agents and handoffs in a copilot: block.
  • Generator: node scripts/sync-agents.mjs writes the pointers, and --check exits 1 when one is missing or out of date. It removes generated files whose source was deleted, and leaves hand-written files alone.
  • CI: the build-lint job in nodejs.yml runs the generator's spec and --check.
  • Docs: AGENTS.md and .agents/README.md say to edit only the source file and re-run the script.

The generated Copilot frontmatter is byte-identical to before. Only the HTML comment in each pointer changed.

Motivation / Context

Each pointer used to carry a hand-copied copy of its agent's frontmatter ("copy its frontmatter here unchanged"), and those copies would drift over time.

Copilot only discovers custom agents in .github/agents/ (VS Code also reads .claude/agents/), not in .agents/agents/. Adding .agents/agents through chat.agentFilesLocations is not recommended, because Copilot CLI and the Copilot app ignore editor location settings. So the pointer files stay, and they are now generated.

The generator also supports a claude: block that writes Claude Code subagents to .claude/agents/. No agent uses it yet: VS Code Copilot also loads .claude/agents/, so every agent would show up twice in its picker.

Type of Change (check all that apply):

  • CI/CD
  • Tests
  • Skills/Agents

Component(s) / Area(s) Affected:

Agent infrastructure (.agents/agents, .github/agents), scripts/, nodejs.yml

How Has This Been Tested?

  • Unit tests: node --test scripts/sync-agents.spec.mjs, 10 tests passing (parsing, CRLF input, invalid frontmatter, rendering, orphan removal)
  • Manual testing: regenerated all pointers and confirmed the Copilot frontmatter is unchanged; --check passes
  • actionlint passes on nodejs.yml; ESLint passes on the new scripts; npm run lint:lib passes (0 errors)

🤖 Generated with Claude Code

Each .github/agents pointer carried a hand-copied copy of its agent's
frontmatter. Generate the pointers with scripts/sync-agents.mjs instead,
and fail CI when they are out of date.

The shared definitions in .agents/agents now keep tool-neutral fields
(name, description) at the top level and the Copilot tools, agents and
handoffs in a copilot block. The generated Copilot frontmatter is
unchanged.

The generator can also write Claude Code subagents from a claude block.
No agent uses it, because VS Code Copilot also loads .claude/agents and
would list every agent twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An active moderate issue remains because the sync script can overwrite hand-written agent files at expected output paths, risking silent data loss.

1 open issue
What changed in this PR

Adds generation of Copilot agent pointers from shared agent definitions, with synchronization tests, CI drift checks, and updated documentation.

Changes:

  • Added the synchronization generator and tests.
  • Migrated agent definitions to tool-specific blocks.
  • Regenerated pointers and documented the workflow.
File Description
scripts/​sync-agents.spec.mjs Adds tests for agent parsing, rendering, synchronization, and orphan removal.
scripts/​sync-agents.mjs Implements generation and validation of tool-specific agent pointer files.
AGENTS.md Documents the shared agent definition and pointer generation workflow.
.github/​workflows/​nodejs.yml Runs generator tests and checks generated pointers for drift in CI.
.github/​agents/​theming-styles-agent.md Updates the generated Copilot pointer for the theming styles agent.
.github/​agents/​tdd-test-writer-agent.md Updates the generated Copilot pointer for the TDD test writer agent.
.github/​agents/​migration-agent.md Updates the generated Copilot pointer for the migration agent.
.github/​agents/​feature-orchestrator-agent.md Updates the generated Copilot pointer for the feature orchestrator agent.
.github/​agents/​feature-implementer-agent.md Updates the generated Copilot pointer for the feature implementer agent.
.github/​agents/​demo-sample-agent.md Updates the generated Copilot pointer for the demo sample agent.
.github/​agents/​component-readme-agent.md Updates the generated Copilot pointer for the component README agent.
.github/​agents/​changelog-agent.md Updates the generated Copilot pointer for the changelog agent.
.github/​agents/​bug-fixing-orchestrator-agent.md Updates the generated Copilot pointer for the bug-fixing orchestrator agent.
.github/​agents/​bug-fixing-implementer-agent.md Updates the generated Copilot pointer for the bug-fixing implementer agent.
.agents/​README.md Documents shared agent definitions, generated outputs, and synchronization commands.
.agents/​agents/​theming-styles-agent.md Moves Copilot configuration into the shared theming styles agent definition.
.agents/​agents/​tdd-test-writer-agent.md Moves Copilot configuration into the shared TDD test writer agent definition.
.agents/​agents/​migration-agent.md Moves Copilot configuration into the shared migration agent definition.
.agents/​agents/​feature-orchestrator-agent.md Moves Copilot configuration into the shared feature orchestrator agent definition.
.agents/​agents/​feature-implementer-agent.md Moves Copilot configuration into the shared feature implementer agent definition.
.agents/​agents/​demo-sample-agent.md Moves Copilot configuration into the shared demo sample agent definition.
.agents/​agents/​component-readme-agent.md Moves Copilot configuration into the shared component README agent definition.
.agents/​agents/​changelog-agent.md Moves Copilot configuration into the shared changelog agent definition.
.agents/​agents/​bug-fixing-orchestrator-agent.md Moves Copilot configuration into the shared bug-fixing orchestrator agent definition.
.agents/​agents/​bug-fixing-implementer-agent.md Moves Copilot configuration into the shared bug-fixing implementer agent definition.

Review effort: Lite

Comment thread scripts/sync-agents.mjs
Comment on lines +209 to +211
const write = [...outputs]
.filter(([file, text]) => !existing.has(file) || normalize(existing.get(file)) !== text)
.map(([file]) => file);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants